package com.jh3502.vivo.function.dialog;

import android.support.annotation.NonNull;

import com.jh3502.vivo.base.BaseCallback;
import com.jh3502.vivo.base.BaseJson;
import com.jh3502.vivo.base.BasePresenter;
import com.jh3502.vivo.base.BaseView;
import com.jh3502.vivo.utils.Utils;

import java.util.List;

/**
 * @author harisucici
 * @date 2017/6/19
 */

public class BankChoosePresenter extends BasePresenter<BankChoosePresenter.BankChooseView> {
    BankChooseModel mBankChooseModel;

    BankChooseView mBankChooseView;


    public void setBankChooseView(BankChooseView mBankChooseView) {
        this.mBankChooseView = mBankChooseView;

    }

    public void toFindOpenBank() {
        mBankChooseView.showLoadingDialog();
        if (mBankChooseModel == null) {
            mBankChooseModel = new BankChooseModel(mBankChooseView.getActContext());
        }

        mBankChooseModel.findOpenBank(new BaseCallback(mBankChooseView) {
            @Override
            public void responseSuccess(@NonNull BaseJson baseJson) {


                mBankChooseView.findOpenBankSuccess(Utils.getInstance().jsa2listString(baseJson.getObj().toString()));
            }
        });
    }

    @Override
    public void cancelCall() {

    }

    public interface BankChooseView extends BaseView {

        void findOpenBankSuccess(List<String> strings);
    }
}
